/*
 * UltimateEvolutionResource.h
 *
 *  Created on: 2014. 2. 18.
 *      Author: mega
 */

#ifndef ULTIMATEEVOLUTIONRESOURCE_H_
#define ULTIMATEEVOLUTIONRESOURCE_H_

#include <map>

namespace ProjectZ { namespace NResource {

class UltimateEvolutionResource
{
public:
	enum EvolutionType
	{
		EM_ULTIMATE_BATTLEPET = 0,	// 전투펫 궁극진화
		EM_ULTIMATE_FAIRY,			// 페어리 궁극진화
		EM_FAIRY_EVOLUTION,			// 페어리 일반진화
	};

public:
	struct Key
	{
		int evType;
		int elType;
		int level;

		Key() : evType(0), elType(0), level(0) {}
		Key(int evType, int elType, int level) : evType(evType), elType(elType), level(level) {}

		bool operator == (const Key & rSide) const
		{
			if (this->evType == rSide.evType
					&& this->elType == rSide.elType
					&& this->level == rSide.level)
			{
				return true;
			}

			return false;
		}

		bool operator < (const Key & rSide) const
		{
			if (this->evType < rSide.evType)
			{
				return true;
			}
			else if (this->evType == rSide.evType)
			{
				if (this->elType < rSide.elType)
				{
					return true;
				}
				else if (this->elType == rSide.elType)
				{
					if (this->level < rSide.level)
					{
						return true;
					}
				}

			}

			return false;
		}
	};

public:
	struct Flyweight
	{
		int _EVOLUTION_TYPE;
		int _ELEMENT_TYPE;
		int _LEVEL;
		int _ITEM1_TID;
		int _ITEM1_QUANTITY;
		int _ITEM2_TID;
		int _ITEM2_QUANTITY;
	};

public:
	UltimateEvolutionResource();
	virtual ~UltimateEvolutionResource();

	bool		LoadResource();
	Flyweight *	GetFly(Key & clsKey);

public:
	typedef std::map<Key, Flyweight *>		ULTIMATETREE;

private:
	void	Clear();

private:
	ULTIMATETREE	clsFlyTree;
};

} /*NResource*/ } /*ProjectZ*/


#endif /* ULTIMATEEVOLUTIONRESOURCE_H_ */
